package com.luiz.aero.android.connection;

import java.io.FileNotFoundException;
import java.io.IOException;

public class BluetoothManager {
	
	private BluetoothConnection arduinoConnection;
	
	public void writeArduinoNewValues(int aileron, int motor, int elevator, int leme){
		String message = "" + aileron + ";" + motor + ";" + elevator + ";" + leme;
		byte[] messageInByte = message.getBytes();
		arduinoConnection.write(messageInByte);
	}




	public boolean setBluetoothConnection(String deviceName) throws Exception {
		
		try {
			arduinoConnection = new BluetoothConnection(deviceName);
			arduinoConnection.start();
			return true;
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}

	}

}
